import sys
import os
import subprocess


maFileList = []
MAYABATCHPATH = r'C:/Program Files/Autodesk/Maya2018/bin/mayabatch.exe'

currentPath = os.path.dirname(__file__)
publishPath = '%s/myPlayBlast.py' % currentPath
melFile = '%s/playBlast.mel' % currentPath
print ("currentPath", currentPath)
print ("melFile", melFile)
path =  "E:/test/"
listpath = os.listdir (path)
print ( listpath )
for ii in listpath :
    maFileList.append(path + ii)
print(maFileList)
newFile = "E:/test/ddddddd.ma"
for ii in maFileList:
    cmd = '"{mayaBatchPath}" -script "{melFile}" "{newFile}" "{publishPath}" "{maPath}" "{currentFolder}"'.format(
        mayaBatchPath=MAYABATCHPATH,
        melFile=melFile,
        newFile = newFile ,
        publishPath=publishPath,
        maPath=ii,
        currentFolder=os.path.dirname(ii),

    )
    subprocess.check_call(cmd, shell=True)